import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

url = 'https://www.w3school.com.cn/'
chrome = webdriver.Chrome()
chrome.get(url)
time.sleep(2)

ipt = chrome.find_element(By.ID, 'searched_content')
ipt.send_keys('python')  # 输入内容
time.sleep(2)
ipt.clear()
time.sleep(2)

ipt.send_keys(Keys.ENTER)

time.sleep(3)

chrome.close()  # 关闭浏览器驱动